package com.eflow.model.flowable.utils;

import com.eflow.model.flowable.CommonDeserializer;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;

/**
 * @author hui se
 * @description
 * @create 2021-03-08 10:07
 **/
public class JSONUtil {
    private static ObjectMapper objectMapper ;
    public static ObjectMapper objectMapper(){
        if(objectMapper == null){
            objectMapper = new ObjectMapper();
            SimpleModule simpleModule= new SimpleModule();
            simpleModule.addDeserializer(Enum.class,new CommonDeserializer());
            objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
            objectMapper.registerModule(simpleModule);
        }
       return objectMapper;
    }
}
